<?php
abstract class soap_array_base 
{
    public function add(&$array, $item)
    {
    	if (is_object($array))
    	{
    		$temp = $array;
    		$array = array();
    		$array[] = $temp;
    		$array[] = $item;
    	}elseif(is_null($array)){
    		$array = $item;    		
    	}elseif(is_array($array))
    	{
    		$array[] = $item;
    	}else{
    		throw new Exception("Soap Array Add Fail :(");
    	}
    }
    
    abstract public function as_array();    
    
    protected function to_array($array)
    {
    	if (is_null($array))
    	{
    		return $array;
    	}elseif(is_object($array))
    	{
    		$temp = array();
    		$temp[] = $array;
    		return $temp;
    	}elseif(is_array($array))
    	{
    		return $array;
    	}else{
    		throw new Exception("Soap Array as_array Fail :(");	
    	}
    }
}
 
?>
